using Microsoft.AspNetCore.Components;
using MudBlazor;
using SageKing.Designer.Core.Contracts;
using SageKing.Designer.Core.Models;
using SageKing.Studio.Models;

namespace SageKing.Studio.Pages.Dashboard.Components;

public partial class Info
{
    private IDictionary<string, DataPanelItem> _workflowInfo = new Dictionary<string, DataPanelItem>();

    [Parameter] public WorkflowDefinition WorkflowDefinition { get; set; } = default!;

    protected override void OnParametersSet()
    {
        _workflowInfo = new Dictionary<string, DataPanelItem>
        {
            ["Definition ID"] = new(WorkflowDefinition.DefinitionId),
            ["Version ID"] = new(WorkflowDefinition.Id),
            ["Version"] = new(WorkflowDefinition.Version.ToString()),
            ["Status"] = new(WorkflowDefinition.IsPublished ? "Published" : "Draft"),
            ["Readonly"] = new(WorkflowDefinition.IsReadonly ? "Yes" : "No")
        };
    }
}